/*
 * robot.h
 *
 *  Created on: Jun 25, 2009
 *      Author: matt
 */

#ifndef ROBOT_H_
#define ROBOT_H_
#include "simulobject.h"

class ROBOT: public SIMULOBJECT
{

	friend class SIMULATOR;
	friend class CONSOLE;

private:
	float rrot; /* rotated value in radians*/
	float xpos; /* x position */
	float ypos; /* y position */
	float reset_pnt[3];
	//second set of descriptor:
	float axle_width; /*with of the axle*/
	float speed[2]; /*left and right engine speeds*/
	POLARDCOORD2DF polar_coords;
	vector<float> hull_offsets;
	vector<float> hull_distances;
	vector<LINE2DF> laser;
	bool laser_on;
	VECTOR2DF wheel_directions[2];
	float wheel_distances[2];
public:
	ROBOT(vector<LINE2DF> a):SIMULOBJECT(a){
		Init();
	}
//	virtual ~ROBOT(){};

	void GetHull(vector<LINE2DF>&);
	void ROBOT::GetLaser(vector<LINE2DF> & l) ;
	bool LaserOn();
	void Init();
	void SyncRobot(float[]);
	void SetLaserOn(bool);
	void SetWheels(VECTOR2DF direction1, float dist1, VECTOR2DF direction2, float dist2 );
	void GetWheels(VECTOR2DF &first, VECTOR2DF &second);
	void GetCenterFromFirstWheel(VECTOR2DF &, VECTOR2DF);


protected:

//	LINE2DF* GetHull();

	void Rotate(float);
	void Translate(float, float);

	void SetResetPoint();
	void Reset();

	void Laser();

};

#endif /* ROBOT_H_ */
